# @shuaige : 陈世玉
# @name :04-交互行为.py
# @time :2024/12/5 20:27
from selenium import webdriver
import time
path='chromedriver.exe'
driver = webdriver.Chrome(path)
url='https://www.baidu.com'
driver.get(url)
time.sleep(2)
driver.find_element_by_id('kw').send_keys('周杰伦')#send_keys()输入内容
time.sleep(2)
driver.find_element_by_id('su').click()#click()点击
#滑到底部
js_bottom="window.scrollTo(0,document.body.scrollHeight)"
driver.execute_script(js_bottom)
time.sleep(2)
next=driver.find_element_by_class_name('n')
next.click()
time.sleep(2)
driver.execute_script(js_bottom)
time.sleep(2)
driver.back()
time.sleep(2)

driver.quit()